package com.example.shardingdemo.controller;

import com.example.shardingdemo.entity.Order;
import com.example.shardingdemo.service.OrderService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/testBoot")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @RequestMapping("getOrder/{id}")
    public Order getOrder(@PathVariable long id){
        return orderService.getOrder(id,"");
    }
    @RequestMapping("getOrderPage")
    public PageInfo getOrderPage(){
        return orderService.getOrderPage( 1,  2,"");
    }
    @RequestMapping("saveOrder")
    public String saveOrder(){
        orderService.saveOrder("");
        return "跨表新增订单成功";
    }

    @RequestMapping("getOrderList")
    public List<Order> getOrderList(Order order){
        return orderService.getOrderList(order);
    }

}
